package com.dxt.dao;

import com.dxt.pojo.Company;
import com.dxt.service.CompanyService;
import com.dxt.utils.JDBCUtil;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanListHandler;

import java.sql.SQLException;
import java.util.List;

/**
 * BelongProject: deliveryManage
 * BelongPackage: com.dxt.dao
 * Description:
 *
 * @Author 段鑫涛
 * @Create 2025/3/30 23:41
 * @Version 1.0
 */
public class CompanyDaoImpl implements CompanyDao {
    @Override
    public List<Company> getCompanyList() throws SQLException {
        QueryRunner queryRunner = new QueryRunner(JDBCUtil.getDataSource());
        String sql = "select id,company_name as companyName from sys_company";
        return queryRunner.query(sql, new BeanListHandler<>(Company.class));
    }
}
